package com.vision.core.cl.ui;

import java.util.List;

import com.sencha.gxt.widget.core.client.grid.Grid;
import com.vision.core.cl.mvp.Presenter;

/**
 * Base interface for common views with a {@link Grid} and a form editor.
 * 
 * @author Mark
 *
 */
public interface View<T> extends Maskable {
	
	void setPresenter(Presenter<T> presenter);
	
	// Grid-related Methods %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	void setData(List<T> list);
	T getSelected();
	void update(T obj);
	void remove(T obj);
	
	// Form-related Methods %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	void edit(T obj);
	T getInEditor();
	boolean isDirty();
	boolean isFormValid();
	
	// Utilities %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	void confirm(String header, String message, IConfirmDialogHandler handler);
	
}
